package com.abc.controller;

import com.abc.bean.Department;
import com.abc.bean.Patient;
import com.abc.service.DepartmentService;
import com.abc.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: bc
 * @Date: 2024-11-17 12:44
 * @Description:
 */
@RestController()
@RequestMapping("/patient")
public class PatientController {

    @Autowired
    private PatientService patientService;

    @RequestMapping("/selectPatient")
    public List<Patient> selectPatient(String patientName) {
        return patientService.selectPatient(patientName);
    }
    @RequestMapping("/selectOnePatientById")
    public Patient selectOnePatientById(String id) {
        return patientService.selectOnePatientById(id);
    }
    @RequestMapping("/addPatient")
    public String addPatient(Patient patient) {
        return patientService.addPatient(patient);
    }
    @RequestMapping("/deletePatient")
    public String deletePatient(String id) {
        return patientService.deletePatient(id) > 0 ? "删除成功" : "删除失败";
    }
    @RequestMapping("/updatePatientById")
    public String updatePatientById(Patient patient) {
        return patientService.updatePatientById(patient) > 0 ? "修改成功" : "修改失败";
    }

}
